package immutablecollections.textboxes;

public abstract class TextBox
{
    public final int width;
    public final int height;

    public TextBox(int width, int height)
    {
        this.width = width;
        this.height = height;
    }

    public abstract String getLine(int count);

    @Override
    public String toString()
    {
        StringBuilder sb = new StringBuilder();
        for (int i = 1; i <= getHeight(); i++)
        {
            sb.append(getLine(i));
            sb.append("\n");
        }
        return sb.toString();
    }

    public int getWidth()
    {
        return width;
    }

    public int getHeight()
    {
        return height;
    }
}
